package com.zbkj.crmeb.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.common.PageParamRequest;
import com.google.common.collect.Lists;
import com.zbkj.crmeb.user.dao.UserRelRecordLogDao;
import com.zbkj.crmeb.user.model.UserRelRecordLog;
import com.zbkj.crmeb.user.service.UserRelRecordLogService;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class UserRelRecordLogServiceImpl extends ServiceImpl<UserRelRecordLogDao, UserRelRecordLog> implements UserRelRecordLogService {

    @Resource
    private UserRelRecordLogDao dao;

    @Override
    public List<UserRelRecordLog> findByParentId(Integer parentId) {
        if (parentId == null) {
            return Lists.newArrayList();
        }
        LambdaQueryWrapper<UserRelRecordLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(UserRelRecordLog::getParentId, parentId);
        return dao.selectList(wrapper);
    }

    @Override
    public List<UserRelRecordLog> findPage(Integer parentId, PageParamRequest pageParamRequest) {
        LambdaQueryWrapper<UserRelRecordLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(UserRelRecordLog::getParentId, parentId);
        return dao.selectList(wrapper);
    }
}
